package com.varian.auth.convert;

import com.varian.auth.model.dto.OAuth2RegisteredClientDTO;
import com.varian.auth.model.entity.OAuth2RegisteredClient;
import com.varian.auth.model.vo.OAuth2RegisteredClientVO;
import org.mapstruct.*;

import java.util.List;

/**
 * @author ben
 * @since 2024/6/27
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
public interface OAuth2RegisteredClientConvert {

    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "deleted", ignore = true),
            @Mapping(target = "version", ignore = true)
    })
    OAuth2RegisteredClient toEntity(OAuth2RegisteredClientDTO dto);

    @Mappings({
            @Mapping(target = "deleted", ignore = true),
            @Mapping(target = "version", ignore = true)
    })
    OAuth2RegisteredClient toEntity(Long id, OAuth2RegisteredClientDTO dto);

    @Named("toVO")
    @Mappings({})
    OAuth2RegisteredClientVO toVO(OAuth2RegisteredClient registeredClient);

    @IterableMapping(qualifiedByName = "toVO")
    List<OAuth2RegisteredClientVO> toVO(List<OAuth2RegisteredClient> list);
}
